#! /usr/bin/wish -f
#------------------------------------------------
# Author:    kvkrishna
# Created:   Tue Apr 19 17:54:52 IST 2011
# File Name: Power
# 
# 
# 
# 
#------------------------------------------------
proc power {base p} {
  set result 1
  while {$p > 0} {
    set result [expr $result*$base]
    set p [expr $p-1]
  }
  return $result
}
entry .base -width 6 -relief sunken -textvariable base
label .label1 -text "to the power"
entry .power -width 6 -relief sunken -textvariable power
button .calc -text "=" -command {set result [power $base $power]}
button .calc1 -text "X" -command exit
label .result -textvariable result
pack .base .label1 .power .calc .calc1 .result -side left -padx 1m -pady 2m
puts "Hi"
#exec -- test &
